// 使用装饰器模拟超快速网速请求
const RequestDecorator = (url: string): MethodDecorator => {
  return (target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {
    const method = descriptor.value

    new Promise<any[]>((resolve, reject) => {
      setTimeout(() => {
        resolve([{ name: 'zrf' }, { name: 'zeng' }])
      }, 2000)
    }).then(users => {
      method(users)
    })

  }
}

{
  class User {
    @RequestDecorator('www.baidu.com')
    public all(users: any[]) {
      console.log(users);
    }
  }

}